<template>
  <div class="page-wrapper">
    <p class="title">
      下拉框默认宽度塌陷问题，form表单项有display:inline-flex导致el-select宽度问题，加上filterable下拉框会附加input框解决宽度问题。
    </p>
    <div>
      <el-select v-model="searchParams.reimburseType" filterable>
        <el-option
          v-for="item in reimburseTypeList"
          :key="item.dictCode"
          :label="item.dictName"
          :value="item.dictCode"
        >
        </el-option>
      </el-select>
    </div>
    <div style="display: inline-flex">
      <el-select v-model="searchParams.reimburseType">
        <el-option
          v-for="item in reimburseTypeList"
          :key="item.dictCode"
          :label="item.dictName"
          :value="item.dictCode"
        >
        </el-option>
      </el-select>
    </div>
    <el-form :inline="true" :model="searchParams" label-width="auto">
      <el-form-item label="发票号码">
        <el-input
          v-model="searchParams.invoiceNumber"
          placeholder="请输入发票号码"
        />
      </el-form-item>
      <el-form-item label="发票状态">
        <el-select v-model="searchParams.invoiceStatus" placeholder="">
          <el-option
            v-for="item in invoiceStatusList"
            :key="item.dictCode"
            :label="item.dictName"
            :value="item.dictCode"
          >
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="报销类别">
        <el-select
          v-model="searchParams.reimburseType"
          filterable
          placeholder=""
        >
          <el-option
            v-for="item in reimburseTypeList"
            :key="item.dictCode"
            :label="item.dictName"
            :value="item.dictCode"
          >
          </el-option>
        </el-select>
      </el-form-item>

      <el-form-item label="发票日期">
        <el-date-picker
          v-model="searchParams.date"
          type="daterange"
          unlink-panels
          range-separator="至"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          :shortcuts="shortcuts"
          format="YYYY-MM-DD"
          value-format="YYYY-MM-DD"
          @change="dateChange"
          :size="size"
        />
      </el-form-item>
      <el-form-item label="是否已导出">
        <el-select v-model="searchParams.exportFlag" filterable placeholder="">
          <el-option label="未导出" value="0" />
          <el-option label="已导出" value="1" />
        </el-select>
      </el-form-item>

      <el-form-item>
        <el-button
          type="primary"
          :disabled="listLoading"
          @click="searchPageQuery"
          class="search-btn"
          >查询</el-button
        >
        <el-button @click="reset" class="reset-btn">重置</el-button>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="addClick" class="search-btn"
          >+ 添加发票</el-button
        >
      </el-form-item>
      <el-form-item>
        <el-button class="search-btn" @click="invoiceExportDown">
          <el-icon color="#fff"><Download /></el-icon>导出
        </el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script setup>
import { ref, onMounted } from "vue";
const value = ref("");
const searchParams = ref({});
const invoiceStatusList = ref([]);
const reimburseTypeList = ref([]);
const data = [
  {
    value: "1",
    label: "Level one 1",
    children: [
      {
        value: "1-1",
        label: "Level two 1-1",
        children: [
          {
            value: "1-1-1",
            label: "Level three 1-1-1",
          },
        ],
      },
    ],
  },
  {
    value: "2",
    label: "Level one 2",
    children: [
      {
        value: "2-1",
        label: "Level two 2-1",
        children: [
          {
            value: "2-1-1",
            label: "Level three 2-1-1",
          },
        ],
      },
      {
        value: "2-2",
        label: "Level two 2-2",
        children: [
          {
            value: "2-2-1",
            label: "Level three 2-2-1",
          },
        ],
      },
    ],
  },
  {
    value: "3",
    label: "Level one 3",
    children: [
      {
        value: "3-1",
        label: "Level two 3-1",
        children: [
          {
            value: "3-1-1",
            label: "Level three 3-1-1",
          },
        ],
      },
      {
        value: "3-2",
        label: "Level two 3-2",
        children: [
          {
            value: "3-2-1",
            label: "Level three 3-2-1",
          },
        ],
      },
    ],
  },
];
</script>

<style scoped lang="scss">
.page-wrapper {
  background: #fff;
  padding: 15px;
  border-radius: 4px;
  .title {
    font-size: 12px;
  }
}
</style>
